package com.hxzy.service.impl;

import com.hxzy.entity.UmsMemberTask;
import com.hxzy.mapper.UmsMemberTaskMapper;
import com.hxzy.service.UmsMemberTaskService;
import com.hxzy.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

public class UmsMemberTaskServiceImpl implements UmsMemberTaskService {
    @Override
    public UmsMemberTask selectByPrimaryKey(Long id) {
        UmsMemberTask umsMemberTask=null;
        try (SqlSession session= MybatisUtil.getSqlSessionFactory().openSession()){
            UmsMemberTaskMapper mapper = session.getMapper(UmsMemberTaskMapper.class);
           umsMemberTask = mapper.selectByPrimaryKey(id);
        }
        return umsMemberTask;
    }

    @Override
    public boolean insert(UmsMemberTask record) {
        int count=0;
        try (SqlSession session= MybatisUtil.getSqlSessionFactory().openSession()){
            UmsMemberTaskMapper mapper = session.getMapper(UmsMemberTaskMapper.class);
            count = mapper.insert(record);
        }
        return count>0;
    }

    @Override
    public boolean updateByPrimaryKey(UmsMemberTask record) {
        int count=0;
        try (SqlSession session= MybatisUtil.getSqlSessionFactory().openSession()){
            UmsMemberTaskMapper mapper = session.getMapper(UmsMemberTaskMapper.class);
            count = mapper.updateByPrimaryKey(record);
        }
        return count>0;
    }
}
